﻿@{
    ViewBag.Title = "Designate user to role";
}

<fieldset>
<legend>Designate user to role</legend>

<select id="UserType">
            <option value="1">Admin</option>
            <option value="2">Student</option>
            <option value="3">Professor</option>
</select>

<div id="divSelect"></div>

</fieldset>
<script language="javascript" type="text/javascript">
    $(document).ready(function () {
        $("#UserType").change(function () {
            if (this[this.selectedIndex].value == 2) {
                $("#divSelect").load("/Role/GetGroups", this[this.selectedIndex].value);
            }
            else if (this[this.selectedIndex].value == 3) {
                $("#divSelect").load("/Role/GetUsers", this[this.selectedIndex].value);
            }
            else {
                $("#divSelect").load("/Role/GetUsers", this[this.selectedIndex].value);
            }
        });
        $("#UserType").change();
    });
</script>